package com.gaogao.java;

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader;

public class SinglePen {
    private static SinglePen e=new SinglePen();
    private SinglePen(){

    }
    public static SinglePen e(){
        System.out.println("饿汉式");
        System.out.println(e.toString());
        return e;
    }
}
class SingleTest{
    private static SingleTest singleTest;
    private SingleTest(){

    }
    public static SingleTest l(){
        System.out.println("懒汉式");
        if (singleTest==null){
            return new SingleTest();
        }

        return singleTest;
    }


    public void aa(){
        System.out.println("你好");
    }
}
class Test{
    public static void main(String args[]){
      System.out.println(SinglePen.e().toString());
        SingleTest s=SingleTest.l();
        System.out.println(s.toString());

    }

}
